// sakura.js - 樱花飘落效果
(function() {
    const sakuraCount = 25; // 樱花数量
    const sakuraContainer = document.body; // 樱花容器

    // 创建樱花元素
    for (let i = 0; i < sakuraCount; i++) {
        const sakura = document.createElement('div');
        sakura.classList.add('sakura');
        sakuraContainer.appendChild(sakura);
    }

    // 动画效果
    const style = document.createElement('style');
    style.innerHTML = `
        .sakura {
            position: absolute;
            top: -50px;
            width: 10px;
            height: 10px;
            background-color: #ffccff;
            border-radius: 50%;
            animation: fall 10s linear infinite;
            pointer-events: none;
        }

        @keyframes fall {
            0% {
                transform: translateX(0) translateY(0);
                opacity: 1;
            }
            100% {
                transform: translateX(calc(100vw * 0.5)) translateY(100vh);
                opacity: 0;
            }
        }

        /* 随机分布位置 */
        .sakura:nth-child(odd) {
            animation-duration: 12s;
            animation-delay: -1s;
        }

        .sakura:nth-child(even) {
            animation-duration: 15s;
            animation-delay: -3s;
        }
    `;
    document.head.appendChild(style);
})();
